package com.zjcode.cdcer.controller;

import com.alibaba.fastjson.JSONObject;
import com.chinatechstar.component.commons.controller.BaseController;
import com.chinatechstar.component.commons.supports.PageData;
import com.zjcode.cdcer.model.basic.JsonObj;
import com.zjcode.cdcer.service.TkmSysUserService;
import io.swagger.annotations.ApiOperation;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

@RestController
@Slf4j
@RequestMapping("/v1/tkmSysUser/")
public class TkmSysUserController extends BaseController {

    @Autowired
    private TkmSysUserService tkmSysUserService;

    @PostMapping("updateUserPassword")
    @ApiOperation("修改密码")
    public JsonObj updateUserPassword() {
        PageData pageData = getPageData();
        tkmSysUserService.updateUserPassword(pageData);
        return JsonObj.success("修改成功!");
    }


    @GetMapping("gettoken")
    public JsonObj getToken(HttpServletRequest request, HttpServletResponse response) {
        PageData pageData = getPageData();
        return tkmSysUserService.getToken(pageData);
    }
}
